<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.ecside.org" prefix="ec"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>项目计划</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
<link rel="stylesheet" type="text/css" href="css/default/easyui.css">
<script src="js/jquery.easyui.min.js" language="javascript"></script>
<script src="js/treegrid-dnd.js" language="javascript"></script>
<script>
function loadPlanData(){
	$('#tt').treegrid({
		url: "<%=pageBean.getHandlerURL()%>&actionType=loadPlanData&projectId=<%=pageBean.inputValue("projectId")%>",
	    idField:'ppaId',
	    treeField:'ppaName',
	    fit: true,
	    columns:[[
	         	{field:'ppaName',title:'工作名称',width:200},
	         	{field:'ppaType',title:'类型',width:100,hidden:true},
	         	{field:'ppaContent',title:'工作描述',width:400},
	           	{field:'ppaCharge',title:'负责人',width:150},
	           	{field:'ppaWorkDay',title:'工作人天',width:80},
	           	{field:'ppaStartTime',title:'开始日期',width:100},
	           	{field:'ppaState',title:'当前状态',width:100},
	           	{field:'ppaEndTime',title:'结束日期',width:100}
	    ]],
	    onLoadSuccess: function(row){
			$(this).treegrid('enableDnd', row?row.ppaId:null);
		},
        rowStyler: function (row) {
            if(row.ppaName=='项目启动会'){
                return 'background-color:red;';
            }
        },
		onSelect: function () {
			var node = $('#tt').treegrid('getSelected');
			$("#ppaId").val(node.ppaId);
			
	    },
	    onDblClickRow: function () {
			var node = $('#tt').treegrid('getSelected');
			openEditNodeBox(node);
	    }
	});
}

var operaRequestBox;
function openCreateNodeBox(operaType){
	var ppaId = $("#ppaId").val();
	if (!operaRequestBox){
		operaRequestBox = new PopupBox('operaRequestBox','新增节点',{size:'big',top:'2px'});
	}
	var url = 'index?ProcPlanAdminManageEdit&operaType='+operaType+'&ppaId='+ppaId;
	operaRequestBox.sendRequest(url);
}

var operaEditRequestBox;
function openEditNodeBox(node){
	var ppaId = $("#ppaId").val();
	if (ppaId == null || ppaId == ''){
		jAlert('请先选中一条记录!');
		return;
	}
	if (!operaEditRequestBox){
		operaEditRequestBox = new PopupBox('operaEditRequestBox','编辑节点',{size:'big',top:'2px'});
	}
	var url = 'index?ProcPlanAdminManageEdit&operaType=update&ppaId='+node.ppaId;
	operaEditRequestBox.sendRequest(url);
}

function copyNodeBox(){
	var ppaId = $("#ppaId").val();
	if (ppaId == null || ppaId == ''){
		jAlert('请先选中一条记录!');
		return;
	}
	openCreateNodeBox('copy');
}
</script>
</head>
<body onload="loadPlanData()">
<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
<%@include file="/jsp/inc/message.inc.jsp"%>
<div id="__ToolBar__">
<table class="toolTable" border="0" cellpadding="0" cellspacing="1">
<tr>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="A" align="center" onclick="openCreateNodeBox('insert')"><input value="&nbsp;" title="新增" type="button" class="createImgBtn" />新增</td>
   <!-- <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="E" align="center" onclick="openEditNodeBox()"><input value="&nbsp;" title="编辑" type="button" class="editImgBtn" />编辑</td> -->
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="C" align="center" onclick="openCreateNodeBox('copy')"><input value="&nbsp;" title="复制" type="button" class="copyImgBtn" />复制</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="D" align="center" onclick="doDelete($('#'+rsIdTagId).val());"><input value="&nbsp;" title="删除" type="button" class="delImgBtn" />删除</td>
</tr>
</table>
</div>
<div id="defineGridTree" style="margin:2px;">
<table id="tt" class="easyui-treegrid" style="width:100%;height:550px">
</table>
</div>
<input type="hidden" name="ppaId" id="ppaId" value="" />
<input type="hidden" id="projectId" name="projectId" value="<%=pageBean.inputValue("projectId")%>" />
<input type="hidden" name="actionType" id="actionType" />
<script language="JavaScript">
setRsIdTag('ppaId');
</script>
</form>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>